/*
 * Copyright 2003-2005 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */

#include "TypeMeta.h"

#include "MetaIdentified.h"

#include "../common/BigEndianUnsignedShort.h"

type_name meta_identified_name = { "meta.identified" };


void meta_identified_create( meta_identified * ma, char * description )
{
}

void meta_identified_destroy( meta_identified * ma )
{
}

void * meta_identified_construct( type_list * list, type_map * map )
{
	type_item * item = type_list_head( list );	
	char * desc = (char *) type_item_get_ptr( item );
	
	meta_identified * identified = (meta_identified *) type_malloc( sizeof( meta_identified ) );
	meta_identified_create( identified, desc );
	return identified;
}

int meta_identified_read( type_input_stream * in, type_element * element)
{
	return type_reader_auto( in, element, &meta_identified_construct );
}


int meta_identified_write( type_output_stream * out, void * o, type_element * element )
{
	meta_identified * mi = (meta_identified *) element;
	
	type_output_write_named_object( out, &meta_name_name, mi->description );
	return TYPE_OK;	
}


int meta_identified_do_read( type_input_stream * in, type_element * element )
{
    type_input_read_named_object( in, &uint16_name );
    int id = type_stack_get_u16( &in->stack ); 
	type_input_read_object( in, id );
	return TYPE_OK;
}


int meta_identified_do_write( type_output_stream * out, void * o )
{	
	type_output_set_error( out, 10 );
	return TYPE_EOF;
}



